package com.ruoyi.system.service.impl;

import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.VoucherOperationLogsMapper;
import com.ruoyi.system.domain.VoucherOperationLogs;
import com.ruoyi.system.service.IVoucherOperationLogsService;

/**
 * 代金券规则操作记录 Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-23
 */
@Service
public class VoucherOperationLogsServiceImpl implements IVoucherOperationLogsService
{
    @Autowired
    private VoucherOperationLogsMapper voucherOperationLogsMapper;

    /**
     * 通过id查询代金券规则操作记录
     *
     * @param id 代金券规则操作记录主键
     * @return 代金券规则操作记录
     */
    @Override
    public VoucherOperationLogs selectVoucherOperationLogsById(Long id)
    {
        return voucherOperationLogsMapper.selectVoucherOperationLogsById(id);
    }

    /**
     * 通过条件查询代金券规则操作记录列表
     *
     * @param operatedStoreName,operationType,voucherCode,operationStartTime,operationEndTime 操作门店，操作类型，代金券编码，操作开始时间，操作结束时间
     * @return 代金券规则操作记录
     */
    @Override
    public List<VoucherOperationLogs> selectVoucherOperationLogsListByConditions(String operatedStoreName, String operationType, String voucherCode, Date operationStartTime, Date operationEndTime)
    {
        return voucherOperationLogsMapper.selectVoucherOperationLogsListByConditions(operatedStoreName,operationType,voucherCode,operationStartTime,operationEndTime);
    }

    /**
     * 新增代金券规则操作记录
     *
     * @param voucherOperationLogs 代金券规则操作记录
     * @return 结果
     */
    @Override
    public int insertVoucherOperationLogs(VoucherOperationLogs voucherOperationLogs)
    {
        voucherOperationLogs.setCreateTime(DateUtils.getNowDate());
        return voucherOperationLogsMapper.insertVoucherOperationLogs(voucherOperationLogs);
    }

    /**
     * 修改代金券规则操作记录
     *
     * @param voucherOperationLogs 代金券规则操作记录
     * @return 结果
     */
    @Override
    public int updateVoucherOperationLogs(VoucherOperationLogs voucherOperationLogs)
    {
        return voucherOperationLogsMapper.updateVoucherOperationLogs(voucherOperationLogs);
    }

    /**
     * 通过id批量删除代金券规则操作记录信息
     *
     * @param ids 需要删除的代金券规则操作记录主键
     * @return 结果
     */
    @Override
    public int deleteVoucherOperationLogsByIds(Long[] ids)
    {
        return voucherOperationLogsMapper.deleteVoucherOperationLogsByIds(ids);
    }

    /**
     * 通过id删除代金券规则操作记录信息
     *
     * @param id 代金券规则操作记录主键
     * @return 结果
     */
    @Override
    public int deleteVoucherOperationLogsById(Long id)
    {
        return voucherOperationLogsMapper.deleteVoucherOperationLogsById(id);
    }
}
